Compiling Maps for AMA
The version of q3map.exe bundled with the FAKKTools is the map-compiler of choice for the amateur American McGee's Alice (AMA) mapper. However, there are two problems with using this compiler to build a map for AMA. Firstly The FAKKTools version of q3map is designed specifically for compiling maps for Heavy Metal FAKK2 (HMF2) and whilst the AMA BSP format is based closely on the HMF2 BSP format there are some differences. Thankfully the Machinations Toolkit BSP2Wonderland tool can take a compiled HMF2 format BSP and convert it into an AMA format BSP with the minimum of fuss. Secondly there is a limit on the number of shaders q3map can load and AMA has too many shaders in its basescripts directory for q3map to handle. Again the solution to this problem is simple due to the fact that once some of the shaders that are not used in map compilation are removed from the basescripts directory the total figure of shaders is low enough for successful compilation. We must simply put those shaders back to run the game. Using Windows batch files this entire process can be automated to the click of a button. When following this tutorial please bear in mind that my working AMA directory is d:alice and that I keep all my working files in a directory called d:alicebaseq3 and copy the finished files into d:alicebase to test them. I keep my compilers and utilities in d:aliceradiant. Obviously if you intend to do what I have done here you must change the directory paths to reflect your own set-up. Lets address the second problem first. Create an empty directory in your base directory called scripts2, this is where we will temporarily store the extraneous shader files whilst we compile. Create an empty file in your working maps directory and name it shaders_out.bat. Open this file in notepad and input the following. @echo off move d:alicebasescriptsdecals.shader d:alicebasescripts2 move d:alicebasescriptsmodels.shader d:alicebasescripts2 move d:alicebasescriptsskin.shader d:alicebasescripts2 move d:alicebasescriptssprites.shader d:alicebasescripts2 move d:alicebasescriptstest.shader d:alicebasescripts2 move d:alicebasescriptsui.shader d:alicebasescripts2 These lines are MS-DOS commands. @echo off, believe it or not, turns off the echo. This means that it only prints the output from the command you run, in this case the move command, instead of printing out the entire command and then the output as well. These move commands are moving the shader files that you are very unlikely to use when building a map to your new basescripts2 directory, obviously if you do decide to use any of these shaders in your map you'll have to remove that line from your batch file. Save shaders_out.bat, create another file called shaders_in.bat and input the following: @echo off move d:alicebasescripts2decals.shader d:alicebasescripts move d:alicebasescripts2models.shader d:alicebasescripts move d:alicebasescripts2skin.shader d:alicebasescripts move d:alicebasescripts2sprites.shader d:alicebasescripts move d:alicebasescripts2test.shader d:alicebasescripts move d:alicebasescripts2ui.shader d:alicebasescripts Save this file. You now have two batch files, one to move the extraneous shader files out of the scripts directory and one to put them back. You can try these batch files out by double clicking on them. Now to create your main compilation batch file. There are many ways to go here but I'll just outline two options. You can create a very simple, vanilla-flavoured, batch file for each map, something like: call shaders_out d:aliceradiantq3map -all -gamedir d:alicebase d:alicebaseq3mapsmymap.map d:aliceradiantbsp2wonderland.exe d:alicebaseq3mapsmymap.bsp call shaders_in The lines beginning with call run your two shader batch files. On q3map line I've used the parameter '-all' this tells q3map to perform a full production quality compilation of the map, for more compilation options see Q3map explanation. In this instance, provided all goes well with the compilation, q3map creates a file called mymap.bsp, this file is then run through BSP2Wonderland and should now run in AMA. There are several ways we can improve on the vanilla version. If you've ever run q3map you'll no doubt have noticed that it outputs quite a lot of information. It's good to capture this output since most of it goes off the top of the console window and it can be quite useful for debugging. We capture output from a DOS command and write it to a file by following the command with >''' (to overwrite) or '''>> (to append) followed by filename. Another option open to us is to use parameters for our batch file. Using parameters allows us to pass extra information to a batch file and therefore create one all encompassing compilation routine to run on as many different maps as we like. We access parameters via the gift of the %''' followed by a the number of the parameter we wish to access. So without further ado here is my chocolate-mud-pie flavoured batch file: @echo off echo compiling "%1.map" for AMA. command /c shaders_out > %1_build.log c:aliceradiantq3map -all -gamedir d:alicebase d:alicebaseq3maps%1.map >> %1_build.log echo. >> %1_build.log command /c shaders_in >> %1_build.log d:aliceradiantbsp2wonderland.exe d:alicebaseq3maps%1.bsp >> %1_build.log echo. >> %1_build.log copy d:alicebaseq3maps%1.bsp d:alicebasemaps >> %1_build.log copy d:alicebaseq3maps%1.scr d:alicebasemaps >> %1_build.log echo DONE! check "%1_build.log" for details. If you save this file in your working maps directory as '''compile.bat then all you need to do to compile the file mymap.map is to type into the DOS console: compile mymap You could also create a shortcut with this as the command line or create a batch file containing: call compile mymap You could even write a line to your Radiant QE4 file and launch your batch file from Radiant: bsp_Alice" "! d:alicebaseq3mapscompile $" Which ever way you launch it when we run this command compile.bat substitutes %1 with the first parameter passed to it, in this case the word mymap, then does the following things: 1. Turns off the echoing of commands. 2. Prints out to the screen compiling "mymap.map" for AMA just to let us know what it's doing. 3. Calls the shaders_out batch file and prints the response to a log file named mymap_build.log overwriting this file if it already exists. The reason we use the command command /c here instead of call is that command /c allows us to capture its output using the >''' whereas '''call does not. 4. Compiles the map mymap.map as before and appends q3map's output to the log file. 5. Writes a carriage return to the log file. I put this in just to space out the entries in the log file. 6. Calls the shaders_in batch file and appends it's output to the log file. 7. Converts the map to AMA format as before and appends BSP2Wonderland's output to the log file. 8. Writes another carriage return to the log file. 9 + 10. Copies the finished BSP file and script file for the map to the main maps directory so it can be tested in AMA in both cases appending the output to the log file. If you don't write scripts for your maps then you don't need to bother with the line 10 but there's no harm in leaving it in, it will simply write in the log file that it couldn't find the script. 11. Prints DONE! check "mymap_build.log" for details. to the console screen just to remind us where to find the log file. Once you've got this set-up you can enjoy the benefit of successful one-touch compilation for AMA with automatic generation of a comprehensive log file. Happy mapping. Sleepite Category:Mapping Category:Tutorials